﻿using System.Collections.Generic;
using System.IO;
using System;
using UnityEngine;
using LitJson;

public class ConfigMgr
{

    //读取配置
    public T ReaderConfigFile<T>(string filename) where T : class
    {
        string fileUrl = Application.dataPath + "/Script/ConfigFile/" + filename +".json";
        StreamReader reader = new StreamReader(fileUrl);
        JsonReader js = new JsonReader(reader);
        
        return JsonMapper.ToObject<T>(js);
        
    }

    //==============================================
    private static ConfigMgr instance;

    public static ConfigMgr Instance
    {
        get
        {
            if (instance == null)
                instance = new ConfigMgr();
            return instance;
        }
    }
}
